<?php $this->load->view('navmenu');?>
<div class="maincontent">
        	<div class="contentinner">
            <h4 class="widgettitle ctitle"><?php echo $thread['subject'];?></h4>
                        <div class="widgetcontent">
						</div><!--widgetcontent-->
						
						<div id="accordion2" class="accordion2">
                                    <h3><a href="#">Dikirim Oleh <?=$thread['username']?> , Tanggal <?=date('d-m-Y h:i:s',strtotime($thread['date']))?></a></h3>
                                    <div>
                                        <p>
										Subject : <?=$thread['subject']?> 
										</p>
										<p>
										To : <?=$thread['kepada']?> 
										</p>
										<p>
										Drawing Title : <?=$thread['draw_title']?> 
										</p>
										<p>
										Drawing Number : <?=$thread['draw_number']?> 
										</p>
										<p>
										Location : <?=$thread['location']?> 
										</p>
                                       
										<div class="mediamgr_content">
										<ul class="listfile">
										<?php foreach($files as $file): ?>
										<?php 
										
										if($file['id_sd_thread']==$thread['id_sd_thread'])
										{
										?>
											<li>
												<a href="<?php echo base_url();?>assets/file_upload/<?=$file['nama_file']?>" data-rel="image">
												<?php
												if(strpos($file['nama_file'],'jpg') == TRUE OR strpos($file['nama_file'],'png') == TRUE)
												{
												?>
													<img src="<?php echo base_url();?>assets/template/img/thumbs/image-icon.png" width=60 height=100 alt="" /></a>
												<?php
												}
												elseif(strpos($file['nama_file'],'pdf') == TRUE)
												{
												?>
													<img src="<?php echo base_url();?>assets/template/img/thumbs/pdf.png" width=60 height=100 alt="" /></a>
												<?php
												}
												elseif(strpos($file['nama_file'],'docx') == TRUE OR strpos($file['nama_file'],'doc') == TRUE)
												{
												?>
													<img src="<?php echo base_url();?>assets/template/img/thumbs/doc.png" width=60 height=100 alt="" /></a>
												<?php
												}
												else
												{
												?>
													<img src="<?php echo base_url();?>assets/template/img/thumbs/doc.png" alt="" /></a>
												<?php
												}
												?>
												
												<span class="filename"><?=$file['nama_file']?></span>
											</li>
										<?php
										}
										?>
										<?php endforeach; ?>
										</ul>
										<br class="clearall" />
                        
										</div><!--mediamgr_content-->
                                    </div>
						</div><!--#accordion-->
						<?php if ($this->session->userdata('level')=="3" OR $this->session->userdata('level')=="4")
									{
									if($this->session->userdata('level')=="3" AND  $thread['approved_by_konsultan'] == ""){
									?>
						<?php echo form_open_multipart('project/approveSD');?> 
						<div>
                        <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
						<input type="hidden" name="id_sd_thread" value="<?php echo $thread['id_sd_thread'];?>">
                        <button type="submit" name="status" value="APPROVED" class="btn btn-primary">APPROVE</button>
                        	<a class="btn btn-primary" href="#myModal" data-toggle="modal">REJECT</a>
                        </div><!--widgetcontent-->
						<br /><br />
						<?php echo "</form>"?>
						<?php
						}
						elseif($this->session->userdata('level')==4 AND $thread['approved_by_konsultan'] == "APPROVED" AND $thread['approved_by_mp'] == "")
						{
						?>
						<?php echo form_open_multipart('project/approveSD');?> 
						<div>
                        <!-- Gets replaced with TinyMCE, remember HTML in a textarea should be encoded -->
						<input type="hidden" name="id_sd_thread" value="<?php echo $thread['id_sd_thread'];?>">
                        <button type="submit" name="status" value="APPROVED" class="btn btn-primary">APPROVE</button>
                        	<a class="btn btn-primary" href="#myModal" data-toggle="modal">REJECT</a>
                        </div><!--widgetcontent-->
						<br /><br />
						<?php echo "</form>"?>
						<?php
						}
						}
						?>
						<!-- Untuk Form Comment And Upload-->
						<br />
						
						<h4 class="widgettitle ctitle">Komentar</h4>
						<?php foreach($posts as $post): ?>
						<div id="accordion2" class="accordion2">
						<h3><a href="#">Dikirim Oleh <?=$post['username']?> , Tanggal <?=date('d-m-Y h:i:s',strtotime($post['tanggal']))?></a></h3>
                                    <div>
                                        <p>
										Subject : <?=$post['isi_sd_post']?> 
										</p>
                                    </div>
						</div><!--#accordion-->
						<?php endforeach; ?>	
            </div><!--contentinner-->
        </div><!--maincontent-->
<div aria-hidden="false" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" class="modal hide fade in" id="myModal">
            <div class="modal-header">
              <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
              <h3 id="myModalLabel">Modal Heading</h3>
            </div>
            <div class="modal-body">
			<?php echo form_open_multipart('project/notApprove');?> 
              <h4>Beri Komentar</h4>
			  <p>
				<textarea name="komentar"></textarea>
				<input type="hidden" name="id_sd_thread" value="<?php echo $thread['id_sd_thread'];?>">
				<input type="hidden" name="status" value="REJECT">
	        </div>
            <div class="modal-footer">
              <button data-dismiss="modal" class="btn">Close</button>
              <button type="submit" class="btn btn-primary">Save changes</button>
            </div>
			<?php echo "</form>"?>
    </div><!--#myModal-->